﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Themes/MasterPage.master" AutoEventWireup="true"
    CodeFile="Employee.aspx.cs" Inherits="UserPower_Employee" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style>
        .modalPopup
        {
            background-color: #FAD817;
            border-width: 3px;
            border-style: solid;
            border-color: Gray;
            padding: 3px;
            width: 250px;
        }
        .modalBackground
        {
            filter: alpha(opacity=70);
            opacity: 0.7;
        }
    </style>
    <script src="../Themes/Js/checkItem.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript" src="../Themes/MyCalendar/WdatePicker.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TabTitle" runat="Server">
    <asp:Literal runat="server" ID="title" Text="<%$Resources:Resource,EmployeeInfoMaintain%>"></asp:Literal>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
    <div style="width: 100%;">
        <div class="queryDiv1">
            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="divFrameHead">
                        <span class="querytextCss">
                            <%=Resources.Resource.BasicInfoAdd%><%--基础信息添加--%>
                    </td>
                </tr>
                <tr>
                    <td class="submitborder" style="padding-top: 15px; padding-bottom: 15px;">
                        <table style="margin-bottom: 10px;" width="95%" border="0" align="center" cellpadding="0"
                            cellspacing="0">
                            <tr>
                                <td class="submitborder4">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td class="submitFieldbg">
                                                <%=Resources.Resource.EmployeeID%><%--员工编号--%>
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtEmpNumber" runat="server" Width="120px"></asp:TextBox>
                                                &nbsp;
                                            </td>
                                            <td class="submitFieldbg">
                                                <%=Resources.Resource.EmployeeName%><%--员工姓名--%>
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtEmpName" runat="server" Width="120px"></asp:TextBox>
                                                &nbsp;
                                            </td>
                                            <td align="left">
                                                &nbsp;<asp:Button ID="btnSearch" runat="server" Text="<%$Resources:Resource, btnEnquiry%>"
                                                    Width="60" OnClick="btnSearch_Click" />
                                                &nbsp;&nbsp;
                                                <asp:Button ID="btnNew" runat="server" Text="<%$Resources:Resource, btnAdd%>" Width="60"
                                                    OnClientClick="return Add()" />
                                                &nbsp;&nbsp;
                                                <asp:Button ID="btn_Upload" runat="server" Text="<%$Resources:Resource, ImportEmployee%>"
                                                    Width="60" OnClick="btn_Upload_Click" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <div class="GridDivCss">
            <IMC:GridView ID="EmployeeGridview" runat="server" AllowPaging="true" AllowSorting="true"
                OnRowCommand="EmployeeGridview_RowCommand" OnPageIndexChanging="EmployeeGridview_PageIndexChanging">
                <Columns>
                    <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                        HeaderStyle-Width="15%" ItemStyle-Width="15%" >
                        <HeaderTemplate>
                            <asp:CheckBox ID="all" runat="server" onclick="CheckAllItem(this)" />
                        </HeaderTemplate>
                        <ItemTemplate>
                          <asp:CheckBox ID="single" runat="server" onclick="CheckItem(this)" />
                            <input type="hidden" id="hidDiv" value='<%#Eval("UserID")%>,<%#Eval("UserName")%>,' />
                      <%--      &nbsp;<asp:Label ID="lbEmpUserID" runat="server" Text='<%#Eval("UserID")%>' Visible="false"></asp:Label>--%>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource, EmployeeID%>" ItemStyle-HorizontalAlign="Center">
                        <%--员工编号--%>
                        <ItemTemplate>
                            &nbsp;<asp:Label ID="lbEMPNbr" runat="server" Text='<%#Eval("EmpNbr")%>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource, EmployeeName%>" ItemStyle-HorizontalAlign="Center">
                        <%--员工姓名--%>
                        <ItemTemplate>
                            &nbsp;<asp:Label ID="lbEmpName" runat="server" Text='<%#Eval("EmpName")%>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource,EmployeeDepart%>" ItemStyle-HorizontalAlign="Center">
                        <%--所属部门--%>
                        <ItemTemplate>
                            &nbsp;<asp:Label ID="lbEmpDep" runat="server" Text='<%#Eval("EmpDep")%>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource, EmployeePosition%>" ItemStyle-HorizontalAlign="Center">
                        <%--职位--%>
                        <ItemTemplate>
                            &nbsp;
                            <asp:Label ID="lbEmpPosition" runat="server" Text='<%#Eval("Position")%>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource, EmployeeExt%>" ItemStyle-HorizontalAlign="Center">
                        <%--分机号码--%>
                        <ItemTemplate>
                            &nbsp;
                            <asp:Label ID="lbEmpExtNum" runat="server" Text='<%#Eval("ExtNum")%>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource, EmployeePhone%>" ItemStyle-HorizontalAlign="Center">
                        <%--分机号码--%>
                        <ItemTemplate>
                            &nbsp;
                            <asp:Label ID="lbEmpMTel" runat="server" Text='<%#Eval("MTel")%>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource, EmployeeEmail%>" ItemStyle-HorizontalAlign="Center">
                        <%--邮件--%>
                        <ItemTemplate>
                            &nbsp;
                            <asp:Label ID="lbEmpEMail" runat="server" Text='<%#Eval("EMail")%>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource, EmployeeFax%>" ItemStyle-HorizontalAlign="Center">
                        <%--传真--%>
                        <ItemTemplate>
                            &nbsp;
                            <asp:Label ID="lbEMPFax" runat="server" Text='<%#Eval("Fax")%>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource, EmployeeRemark%>" ItemStyle-HorizontalAlign="Center">
                        <%--备注--%>
                        <ItemTemplate>
                            &nbsp;
                            <asp:Label ID="lbEMPRemark" runat="server" Text='<%#Eval("Remark")%>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource, UserName%>" ItemStyle-HorizontalAlign="Center">
                        <%--用户名--%>
                        <ItemTemplate>
                            &nbsp;<asp:Label ID="lbEmpUserName" runat="server" Text='<%#Eval("UserName")%>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource, UserPassWord%>" ItemStyle-HorizontalAlign="Center">
                        <%--用户密码--%>
                        <ItemTemplate>
                            &nbsp;<asp:Label ID="lbEmpUserPsw" runat="server" Text='<%#Eval("UserPsw").ToString().Length >0?pass(Eval("UserPsw").ToString()) :""%> '
                                Font-Size="8px"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource, Operating%>" ItemStyle-HorizontalAlign="Center">
                        <%-- 操 作 --%>
                        <ItemTemplate>
                            <a href="#" onclick="Upd('<%#Eval("UserID")%>','<%#Eval("UserName")%>','<%#Eval("UserPsw")%>','<%#Eval("EmpName")%>','<%#Eval("EmpNbr")%>','<%#Eval("EmpDep")%>','<%#Eval("Position")%>','<%#Eval("ExtNum")%>','<%#Eval("MTel")%>','<%#Eval("Email")%>','<%#Eval("Fax")%>','<%#Eval("Remark")%>')">
                                <%=Resources.Resource. btnMaintain%>
                            </a>
                            <%--修改--%>
                            <asp:LinkButton ID="lbtn_Del" runat="server" OnClientClick="return isDel()" CommandName="Del"
                                CommandArgument='<%#Eval("UserID")%>' Text="<%$Resources:Resource, btnDel%>"></asp:LinkButton><%--删除--%>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                </Columns>
            </IMC:GridView>
            <asp:HiddenField ID="hidEmployee" runat="server" />
        </div>
        <div style="text-align: center; padding-top: 10px;">
            <input id="btnOK" type="button" class="buttonbgYellow" value="<%$Resources:Resource, btnOK%>"
                onclick="ConfigPU()" runat="server" visible="false" /><%--确 定--%>
            <input id="btnVendorContactCancel" type="button" class="buttonbgYellow" value="<%$Resources:Resource, btnClear%>"
                onclick="Closed()" runat="server" visible="false" /><%--取 消--%>
        </div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <input id="btnPreview" runat="server" type="button" value="" cssclass="buttonbgtwo"
            style="display: none;" />
        <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="btnPreview"
            PopupControlID="Panel1" BackgroundCssClass="modalBackground" CancelControlID="btnCancel"
            DropShadow="true" PopupDragHandleControlID="Panel3" />
        <asp:Panel ID="Panel1" runat="server" Width="700px" Style="display: none" CssClass="modalPopup">
            <asp:Panel ID="Panel3" runat="server" Style="cursor: move; background-color: #DDDDDD;
                border: solid 1px Gray; color: Black">
                <div class="tagdivhead" style="background-color: #D6E0EE; padding-top: 8px">
                    <div class="divcenter">
                        <span>&nbsp;<asp:Label ID="lbtitle" runat="server" CssClass="querytextCss" Width="150px"
                            Height="16px"></asp:Label>
                        </span>
                    </div>
                </div>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ModifytableCss">
                    <tr>
                        <td colspan="6" style="height: 1px">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.EmployeeID%><%--员工编号--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtEmployeNbr" runat="server" Width="120px" MaxLength="20"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage=""
                                ControlToValidate="txtEmployeNbr" Text="*" Display="Dynamic" ValidationGroup="Upd"></asp:RequiredFieldValidator>
                        </td>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.EmployeeName%>
                            <%--员工姓名--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtEmployeName" runat="server" Width="120px" MaxLength="20"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ErrorMessage=""
                                ControlToValidate="txtEmployeName" Text="*" Display="Dynamic" ValidationGroup="Upd"></asp:RequiredFieldValidator>
                        </td>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.EmployeeDepart%><%--所属部门--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtEmployeDepart" runat="server" Width="120px" MaxLength="20"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage=""
                                ControlToValidate="txtEmployeDepart" Text="*" Display="Dynamic" ValidationGroup="Upd"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.EmployeePosition%><%--职位--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtEmployePosition" runat="server" Width="120px"></asp:TextBox>
                        </td>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.EmployeeExt%>
                            <%--分机号--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtEmployeExt" runat="server" Width="120px"></asp:TextBox>
                            <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txtEmployeExt"
                                ErrorMessage="CompareValidator" Display="Dynamic" Operator="GreaterThanEqual"
                                Type="Integer" ValueToCompare="0"><%=Resources.Resource.Number%></asp:CompareValidator>
                        </td>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.EmployeePhone%>
                            <%--手机号码--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtEmployeMTel" runat="server" Width="120px"></asp:TextBox>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtEmployeMTel"
                                ErrorMessage="" Text="<%$Resources:Resource, VerifyPhone%>" Display="Dynamic"
                                ValidationGroup="Upd" ValidationExpression="^1[0-9]{10}$"> </asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.EmployeeEmail%><%--邮件--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtEmployeEmail" runat="server" Width="120px"></asp:TextBox>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtEmployeEmail"
                                Display="Dynamic" Text="<%$Resources:Resource, VerifyEmail%>" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                        </td>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.EmployeeFax%><%--传真--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtEmpFax" runat="server" Width="120px"></asp:TextBox>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="txtEmpFax"
                                Display="Dynamic" Text="<%$Resources:Resource, VerifyFax%>" ValidationExpression="^(0[1-9][0-9]{1,2}\-){0,1}([1-9][0-9]{6,7})$"></asp:RegularExpressionValidator>
                        </td>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.EmployeeRemark%><%--备注--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtEmpRemark" runat="server" Width="120px" MaxLength="150"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.UserName%>
                            <%--用户名--%>
                        </td>
                        <td class="querycoltdCss">
                            <%--  <input id="txtUserName" type="text" runat="server" onkeyup="checkpsw()" style="width: 120px; height:18px; border:gray 1px solid;" />--%>
                            <asp:TextBox ID="txtUserName" runat="server" Width="120px" MaxLength="20"></asp:TextBox>
                            <%-- <asp:RequiredFieldValidator ID="RequiredUserName" runat="server"
                                ErrorMessage="" ControlToValidate="txtUserName" Text="*" Display="Dynamic" ValidationGroup="Upd"></asp:RequiredFieldValidator>--%>
                        </td>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.UserPassWord%><%--密码--%>
                        </td>
                        <td class="querycoltdCss">
                            <%-- <input id="txtPsw" type="text" runat="server" style="width: 120px; height:18px; border:gray 1px solid;" />--%>
                            <asp:TextBox ID="txtPsw" runat="server" Width="120px" MaxLength="20" TextMode="Password"></asp:TextBox>
                            <%--                      <asp:RequiredFieldValidator ID="RequiredPsw" runat="server"   ErrorMessage=""
                                ControlToValidate="txtPsw" Text="*" Display="Dynamic" ValidationGroup="Upd"></asp:RequiredFieldValidator>--%>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" style="height: 1px">
                            &nbsp;<asp:HiddenField runat="server" ID="hidUserID" Value="0" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" style="padding-bottom: 3; padding-top: 3">
                            <%--保 存--%>
                            <asp:Button ID="btnAdd" runat="server" Text="<%$Resources:Resource, btnSave%>" OnClick="btnAdd_Click"
                                ValidationGroup="Upd" />
                            &nbsp;&nbsp;
                            <%--保 存--%>
                            <asp:Button ID="btnUpd" runat="server" Text="<%$Resources:Resource, btnSave%>" OnClick="btnUpd_Click"
                                ValidationGroup="Upd" />
                            &nbsp;&nbsp;
                            <asp:Button ID="btnCancel" runat="server" Text="<%$Resources:Resource, btnClear%>" /><%--取 消--%>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" style="height: 1px">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </asp:Panel>
    </div>
    <script type="text/javascript">
        function Add() {
            document.getElementById("<%= lbtitle.ClientID%>").innerHTML = "<%=Resources.Resource.EmployeeInfoAdd %>"; //"人员信息添加";
            document.getElementById("<%= txtUserName.ClientID%>").value = "";
            document.getElementById("<%= txtPsw.ClientID%>").value = "";
            document.getElementById("<%= txtEmployeName.ClientID%>").value = "";
            document.getElementById("<%= txtEmployeNbr.ClientID%>").value = "";
            document.getElementById("<%= txtEmployeDepart.ClientID%>").value = "";
            document.getElementById("<%= txtEmployePosition.ClientID%>").value = "";
            document.getElementById("<%= txtEmployeExt.ClientID%>").value = "";
            document.getElementById("<%= txtEmployeMTel.ClientID%>").value
            document.getElementById("<%= txtEmployeEmail.ClientID%>").value = "";
            document.getElementById('<%= txtEmpFax.ClientID%>').value = "";
            document.getElementById('<%= txtEmpRemark.ClientID%>').value = "";
            document.getElementById('<%= btnUpd.ClientID%>').style.display = "none";
            document.getElementById('<%= btnAdd.ClientID%>').style.display = "";

            document.getElementById('<%= btnPreview.ClientID%>').click();
            return false;
        }

        function Upd(UserID, UserName, UserPsw, EmpName, EmpNbr, EmpDep, Position, ExtNum, MTel, Email, Fax, Remark) {
            document.getElementById("<%= lbtitle.ClientID%>").innerHTML = "<%=Resources.Resource.EmployeeInfoManagement %>"; //人员信息维护
            document.getElementById("<%= hidUserID.ClientID%>").value = UserID;
            document.getElementById("<%= txtUserName.ClientID%>").value = UserName;
            document.getElementById("<%= txtPsw.ClientID%>").value = UserPsw;
            document.getElementById("<%= txtEmployeName.ClientID%>").value = EmpName;
            document.getElementById("<%= txtEmployeNbr.ClientID%>").value = EmpNbr;
            document.getElementById("<%= txtEmployeDepart.ClientID%>").value = EmpDep;
            document.getElementById("<%= txtEmployePosition.ClientID%>").value = Position;
            document.getElementById("<%= txtEmployeExt.ClientID%>").value = ExtNum;
            document.getElementById("<%= txtEmployeMTel.ClientID%>").value = MTel;
            document.getElementById("<%= txtEmployeEmail.ClientID%>").value = Email;
            document.getElementById('<%= txtEmpFax.ClientID%>').value = Fax;
            document.getElementById('<%= txtEmpRemark.ClientID%>').value = Remark;
            document.getElementById('<%= btnUpd.ClientID%>').style.display = "";
            document.getElementById('<%= btnAdd.ClientID%>').style.display = "none";

            document.getElementById('<%= btnPreview.ClientID%>').click();

        }
    </script>
    <script type="text/javascript">


        function ConfigPU() {
            var retval = document.getElementById('<%= hidEmployee.ClientID %>').value;

            window.returnValue = retval;
            Closed();
        }
        function Closed() {
            window.opener = null;
            window.close();
        }
    </script>
 <script>
     function CheckAllItem(oChcek) {
         CheckAll(oChcek, '<%= EmployeeGridview.ClientID %>', '<%= hidEmployee.ClientID %>');
     }

     function CheckItem(oChcek) {
         CheckItemCB(oChcek, '<%= EmployeeGridview.ClientID %>', '<%= hidEmployee.ClientID %>');
     }
     function ConfigPU() {
         var retval = document.getElementById('<%= hidEmployee.ClientID %>').value;

         window.returnValue = retval;
         Closed();
     }
     function Closed() {
         window.opener = null;
         window.close();
     }

     function isDel() {
         return confirm('<%=Resources.Resource.IsDelete %>');
     }
    </script>
</asp:Content>
